﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ERPStore.Host.Extensions;

namespace ERPStore.Host.Start
{
	public class OwinConfig
	{
		public static IDisposable StartSelfHosting()
		{
			var address = ERPStore.Configuration.ConfigurationSettings.AppSettings["webapiAddress"] ?? "http://+:9081";
			Console.WriteLine("Try to start self hosting : {0}", address);

			return Microsoft.Owin.Hosting.WebApp.Start(address, (appBuilder) =>
			{
				appBuilder.ConfigureSignalR();
				appBuilder.ConfigureWebApi();
				Console.WriteLine("Self hosting started");
			});
		}

	}
}
